﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Jalal.Library.Web;
using System.Data.Common;
using System.Data.SqlClient;
using System.Web.Configuration;

namespace Jalal.Library.Data
{
    public class DataFactory
    {
        public static DataMiner GetDataMiner()
        {
            string providerName = WebConfigurationManager.ConnectionStrings[SiteConfigSection.SiteConfiguration.ConnectionStringName].ProviderName;

            if (providerName == "System.Data.SqlClient")
                return new SqlDataMiner();
            else
                return new SqlDataMiner();
        }

        public static DbCommand GetCommand()
        {
            string providerName = WebConfigurationManager.ConnectionStrings[SiteConfigSection.SiteConfiguration.ConnectionStringName].ProviderName;

            if (providerName == "System.Data.SqlClient")
                return new SqlCommand();
            else
                return new SqlCommand();
        }
    }
}
